#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main()
{
	int n;
	string arr;
	cin >> n >> arr;
	int count = 0;
	for (int i = 0; i < n - 1; i++) {
		if (arr[i] == 'V' && arr[i + 1] == 'K') {
			count++;
			arr[i] = 'a';
			arr[i + 1] = 'a';
		}
	}
	for (int i = 0; i < n - 1; i++) {
		if (arr[i] == 'V' && arr[i + 1] == 'V') {
			count++;
			break;
		}
		if (arr[i] == 'K' && arr[i + 1] == 'K') {
			count++;
			break;
		}
	}
	cout << count << endl;
	return 0;
}